package org.NooLab.itexx.retrieval;
 

import java.io.Serializable;
import java.util.Vector;

import org.NooLab.utilities.logging.PrintLog;
import org.NooLab.utilities.strings.StringsUtil;



/**
 * 
 * 
 * container for all rule set items, and some associated functionality
 * 
 * 
 */
public class PreProcRules implements Serializable{
 
	private static final long serialVersionUID = 4333088159864937648L;
	
	
	Vector<PreProcRuleSet> ruleSets = new Vector<PreProcRuleSet>(); 
	
	StringsUtil strgutil = new StringsUtil();
	// =================================
	
	// object references ..............
	

	// main variables / properties ....

	
	// constants ......................
	
	
	// volatile variables .............

	
	// helper objects .................
	PrintLog out  ;

	public PreProcRules(){
		
	}
	

	 
	public void addRule( PreProcRuleSet ruleset){
		
		ruleset.setObj( strgutil );
		ruleSets.add(ruleset);
	}
	
	public PreProcRuleSet getRuleSet( String rulesetName ){
		PreProcRuleSet ruleSet = null;
		String name;
		
		for (int i=0;i<ruleSets.size();i++){
			name = ruleSets.get(i).getName();
			if ( name.contentEquals(rulesetName) ){
				ruleSet = ruleSets.get(i);
				break;
			}
		}
		
		if (ruleSet == null){
		
			ruleSet = new PreProcRuleSet();
			ruleSet.setName(rulesetName) ;
			
		}
		
		ruleSet.setObj(strgutil) ;
		return ruleSet; 
	}
	
	public PreProcRuleSet getRuleSet( int index ){
		PreProcRuleSet ruleSet = null;
		
		
		return ruleSet;
	}
	
	
	public int size(){
		return ruleSets.size();
	}
	
	public Vector<PreProcRuleSet> getRuleSets(){
		return ruleSets;
	}
	
	public PreProcRuleSet getItem( int index ){
		
		return ruleSets.get(index) ;
	}
	
	 
}
